UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hwacKhQ+zw3yJKI9C3anO5A24P1uafstneuzqfueUfc=' 
WHERE 
  key_id = '38864063105e7426e02acc8a9f6ee6afaf4f3025a8d8d11603a9a46875e99153' 
  AND (
    token = 'hwacKhQ+zw3yJKI9C3anO5A24P1uafstneuzqfueUfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028