UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RHOx9FvTq4CNVAtHUvPMbbk636osAaavPGn5B8nJoLE=' 
WHERE 
  key_id = 'a59fa5a3d25da2d78ad85d452bdc6b43521c20453817e151554d9d55b1043033' 
  AND (
    token = 'RHOx9FvTq4CNVAtHUvPMbbk636osAaavPGn5B8nJoLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034