UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D6ZVnI+igqAk9jjUGwkqM7f59cy/quqiIHduA/agqjU=' 
WHERE 
  key_id = '6637aeedbb062f41122e3c948bc2a00690ec09151379089ccf8ef3fb57b09db8' 
  AND (
    token = 'D6ZVnI+igqAk9jjUGwkqM7f59cy/quqiIHduA/agqjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033