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

Query time 0.00029