UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0e5oEZDsfRQeuOCNO+F4PvdTp13nz4fDu6p0QXnx8Fc=' 
WHERE 
  key_id = 'c371622e9a32374f6aab1f538549cf4f51397915443cad9faa19adc6c8f524ed' 
  AND (
    token = '0e5oEZDsfRQeuOCNO+F4PvdTp13nz4fDu6p0QXnx8Fc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029