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

Query time 0.00046