UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WMznrVq2iQeLp4DUJOOTU2Sd5h4iInG9+0t9BJjM2NE=' 
WHERE 
  key_id = '37ca401206aaed4d932f5a0b1cd61ba935194b50cc0692186ddf3d6c030d3fbb' 
  AND (
    token = 'WMznrVq2iQeLp4DUJOOTU2Sd5h4iInG9+0t9BJjM2NE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026