UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R783DZcdzcjMRI14Tu77O9KWuhmHhqt290xJqpHobYk=' 
WHERE 
  key_id = '184366d740d4819a0b9791a4be34c75aae7c0ef27dd9bd8103e154d71598ba8f' 
  AND (
    token = 'R783DZcdzcjMRI14Tu77O9KWuhmHhqt290xJqpHobYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026