UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T5gFNbeAkgzfUDZcLq3LOXkEAmdo2ntZcKyXZ/UB038=' 
WHERE 
  key_id = '9a412339443cf35213d03d7d6b0eea64012e11034994e3c5cf85ad8cb04db8d0' 
  AND (
    token = 'T5gFNbeAkgzfUDZcLq3LOXkEAmdo2ntZcKyXZ/UB038=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034