UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y2DXziARs5DeKoxCWlz14slWECIDEf8uD4EmB3UZ10g=' 
WHERE 
  key_id = '9dd7b1869244f8790bceb8299769189dec95735ba333c910934460baf79bb19a' 
  AND (
    token = 'y2DXziARs5DeKoxCWlz14slWECIDEf8uD4EmB3UZ10g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031