UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSoeN8zNjXvRcCs2evesSQoXwxVKImFVqswKVDNUiKM=' 
WHERE 
  key_id = 'b2dacbeb0318d1282876d3745d43b41818be47570ace8bf41fed32ea656e01b3' 
  AND (
    token = 'CSoeN8zNjXvRcCs2evesSQoXwxVKImFVqswKVDNUiKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017