UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fntr+QThCDjwx+uHu91j72qofuOY1E9d6DGphmoRvDU=' 
WHERE 
  key_id = 'f12faf8407f1fa6bf7832b857add1178841ca83f421c8cbca955f0e8d4036222' 
  AND (
    token = 'fntr+QThCDjwx+uHu91j72qofuOY1E9d6DGphmoRvDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029