UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P2VZxb0ddMP5nD3N4iF4ee6PVbMQaDZKPoUGdXC1sYw=' 
WHERE 
  key_id = '2c9b1d61f20ef594b02aa81d2712c1fb9064ec4cc6c16043e23c49b17f157285' 
  AND (
    token = 'P2VZxb0ddMP5nD3N4iF4ee6PVbMQaDZKPoUGdXC1sYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038