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

Query time 0.00027