UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aoZErNkdaJI361/5B3swFaF7yT0b+L7deaJV4lq68hY=' 
WHERE 
  key_id = '4ef8420d9f56107132c0055571ac5f575151ea8d35e47f192fbe2b315dece32b' 
  AND (
    token = 'aoZErNkdaJI361/5B3swFaF7yT0b+L7deaJV4lq68hY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017