UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z5wQT/mcJI3nz2Ttlahii7lM2ywOFSHyEfdC7QCBDO4=' 
WHERE 
  key_id = '4ca9d693315b30c47250835c56f73fd54c5c68e7629188b4895f0986680d77e7' 
  AND (
    token = 'Z5wQT/mcJI3nz2Ttlahii7lM2ywOFSHyEfdC7QCBDO4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026