UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmj5nesuZUR+BX/UAC200daKqgJYOFX0vWDYzyyC8LY=' 
WHERE 
  key_id = '87e6c42712c1f5603d4778bf5132712616eab63aa0880ba0b43d2733b551e33d' 
  AND (
    token = 'jmj5nesuZUR+BX/UAC200daKqgJYOFX0vWDYzyyC8LY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034