UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AVFtYIOxMniW7cKuPCKCgaEYQFGJsXLwz8raI46zd2M=' 
WHERE 
  key_id = '4693b8e20c2e98157a7b5799b38cfca3c460d0b8b45ea3f31d075f63c82806a5' 
  AND (
    token = 'AVFtYIOxMniW7cKuPCKCgaEYQFGJsXLwz8raI46zd2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040