UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ylMW3p+28+X/ueCRIfnyadJbW0XR5+Cb43B/gSezcpg=' 
WHERE 
  key_id = '27d4f30f3e6a0c6eae8191afbe72c1d63b72715f535d12c1d533cc72e8be5077' 
  AND (
    token = 'ylMW3p+28+X/ueCRIfnyadJbW0XR5+Cb43B/gSezcpg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042