UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mAgPQB1H5VZzuD0kBXXxOZbHzg1arPxCMBmmnF34i2M=' 
WHERE 
  key_id = '5d6b8623f7375a4f3c6c9d127681305483225022f8571540606736c2da421d19' 
  AND (
    token = 'mAgPQB1H5VZzuD0kBXXxOZbHzg1arPxCMBmmnF34i2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023