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

Query time 0.00032