UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nZsCpJ5UHSrN89B2JRnk+CCcqEPEaQAN9Xd+HJ19lXs=' 
WHERE 
  key_id = 'c46da419dd6ab7dbbed635bc2651c681d4e4bf159ca0ea474493a7ce18483281' 
  AND (
    token = 'nZsCpJ5UHSrN89B2JRnk+CCcqEPEaQAN9Xd+HJ19lXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065