UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3bXYoYvIRliWC7kRa1UuHnymqo+uNX3PL3kNVlg2SXs=' 
WHERE 
  key_id = '283c8dbedadd850f920611a5cd34f5be2289b6858892a6e8492dba2b6691ecb5' 
  AND (
    token = '3bXYoYvIRliWC7kRa1UuHnymqo+uNX3PL3kNVlg2SXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032