UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E7Nq2hbRfEGYDroHvR2ryVXkmsVQQ+I4PmpTlDigC+0=' 
WHERE 
  key_id = '990765d5fc9b123f77586a522b8a1117e503ccdf9540e0ab133fa673e88223fa' 
  AND (
    token = 'E7Nq2hbRfEGYDroHvR2ryVXkmsVQQ+I4PmpTlDigC+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028