UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U1wgwpPgfBIuKQKbtIJUxebddMitruCDUsxJwCvhuzk=' 
WHERE 
  key_id = '036534e596a08a1ae35ef4c035e0662aa4dfd52aff89f3040be518cd51b3ff19' 
  AND (
    token = 'U1wgwpPgfBIuKQKbtIJUxebddMitruCDUsxJwCvhuzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034