UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dx1tkjlYPBGbrww0tdWy/+jl6xIJy3WbmKPoPxwOsOU=' 
WHERE 
  key_id = '7289f30843a8ab80e9d0b67c39775b862817861451c81edca2f90a40b5ca9399' 
  AND (
    token = 'Dx1tkjlYPBGbrww0tdWy/+jl6xIJy3WbmKPoPxwOsOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063