UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nkHdPBUaC6qrn9OZ63yUqOx9hU6oz/EaaYj+leeoz5w=' 
WHERE 
  key_id = '2a48a5dd07dd3c1138d08cb75f5cca5512ea7b3ee93ba94220599f9c084caf57' 
  AND (
    token = 'nkHdPBUaC6qrn9OZ63yUqOx9hU6oz/EaaYj+leeoz5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020