UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6npLGbDjQDtgXJESeNo9T56Ieonvy7GOYn20unpdwR0=' 
WHERE 
  key_id = '13454e3f5de853936c125a5785d00aec7ec9f1b71dea175cf734805829cf6133' 
  AND (
    token = '6npLGbDjQDtgXJESeNo9T56Ieonvy7GOYn20unpdwR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065