UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GRD0H8OGkCi4VU5LJlEXni3IYVB6B9m0euH/CTPRNpQ=' 
WHERE 
  key_id = '015723ffd12fbadcb6a5da4788f1efe285b425f3c6e829aa979be110945e1f6d' 
  AND (
    token = 'GRD0H8OGkCi4VU5LJlEXni3IYVB6B9m0euH/CTPRNpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032