UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NKq5G97sUkH1um8m0fk9Am4/Nb1cScj1fdFJpk4oagQ=' 
WHERE 
  key_id = 'c9334a1b47bab23b9b05a07e4fd7c985fea8ccf8c73c81ecdfb566c1e8748819' 
  AND (
    token = 'NKq5G97sUkH1um8m0fk9Am4/Nb1cScj1fdFJpk4oagQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049