UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KExKNetaNsxTHGUu/mU/00NqEIw9SBoFh/43yTswN+s=' 
WHERE 
  key_id = '486ba1f2f9e2f359874983d20d3af461067125d34a06fa68591b1256fec8a132' 
  AND (
    token = 'KExKNetaNsxTHGUu/mU/00NqEIw9SBoFh/43yTswN+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025