UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mXxWIXsR8baqDhgZQT+NP+acOPFUWCwKYBBfcz5uFLc=' 
WHERE 
  key_id = '80168077dacea0e5d74d00e96df390b0f565687233e44c76b57019fea4cb11ee' 
  AND (
    token = 'mXxWIXsR8baqDhgZQT+NP+acOPFUWCwKYBBfcz5uFLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061