UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yd6E6YGm6363BLBBOR+cIGJYThcI6RlxjWEOnOyJ16Q=' 
WHERE 
  key_id = '22aa643c1c1b5dc16bfa118697a585b81e13b16a226b38eb4362fb8fa0ec6afe' 
  AND (
    token = 'yd6E6YGm6363BLBBOR+cIGJYThcI6RlxjWEOnOyJ16Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027