UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NffSyOmAyIY5LgsXhsKexmUAJ6DT/U6ebXkP6yMaVFc=' 
WHERE 
  key_id = 'f01e4e722a4459ecaf7cc5739503763fffad170c99ac9702b965b6f2735405f2' 
  AND (
    token = 'NffSyOmAyIY5LgsXhsKexmUAJ6DT/U6ebXkP6yMaVFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050