UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9exrC6Es641rDHwTzJ5cehlPTLjm7s/AgXEx7NCcUtM=' 
WHERE 
  key_id = 'f1390ac675bd08d099089e54472508cf1234f2932182e2b965e8a4a78d877597' 
  AND (
    token = '9exrC6Es641rDHwTzJ5cehlPTLjm7s/AgXEx7NCcUtM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040