UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YxirFhRuD1ck75gHLZc4ax6ZsyOFGTdXhHsci4ghSX0=' 
WHERE 
  key_id = '9cc336b3065780fe0981e5f190a212bb90773053b404b5f5bb0aca5a5cf9f0d7' 
  AND (
    token = 'YxirFhRuD1ck75gHLZc4ax6ZsyOFGTdXhHsci4ghSX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043