UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y4KBsIaCr60OBRBrBxq6XOvQcgShlWyZh98b7T8FPP4=' 
WHERE 
  key_id = '6473fecba7901e0acdbc6a279af61ecbffb0941b7941e2715ec23dc853208a24' 
  AND (
    token = 'Y4KBsIaCr60OBRBrBxq6XOvQcgShlWyZh98b7T8FPP4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028