UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G2+EEOVNl3p6QecL9yn0Xe+12jn2xARz5ikI+0EfGuc=' 
WHERE 
  key_id = '127e47a6fdcff0ef5499dfd2a315952bba00e399f490d78d14125d7a2bb16346' 
  AND (
    token = 'G2+EEOVNl3p6QecL9yn0Xe+12jn2xARz5ikI+0EfGuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031