UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G+XKVnLjlsZbjZZRwQ4RcxKjkf4GFk3fIG2rxnkWHuE=' 
WHERE 
  key_id = 'dcb4133a6e0a17ce24dda188aaa8c382d5e10c85f9327fdf1a14186342819218' 
  AND (
    token = 'G+XKVnLjlsZbjZZRwQ4RcxKjkf4GFk3fIG2rxnkWHuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038