UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aZ0XFPd/ZqxjpKPJ9xee7mkvvE2PjOsoN/AmcDkwx+U=' 
WHERE 
  key_id = '518e265fb9ff570250d9d4fcd6b50daebac78b1ae05554541ae4e0cc90ad910c' 
  AND (
    token = 'aZ0XFPd/ZqxjpKPJ9xee7mkvvE2PjOsoN/AmcDkwx+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057