UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cLE7Qs81T3leuU/QnT7PpSoIy2/+3e3TfjulxooMIFE=' 
WHERE 
  key_id = 'd1151dc06ec24ae8206174bbce277a98d94560968732aa84785ddb51cff23cc8' 
  AND (
    token = 'cLE7Qs81T3leuU/QnT7PpSoIy2/+3e3TfjulxooMIFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017