UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ySTi29/VXpvJNGiKh5ZJLup72eMdb3iSN/hH+KjxMJc=' 
WHERE 
  key_id = 'b2de8441567101b525854ff04022e625cf4deae5294bac118064f7b384b75600' 
  AND (
    token = 'ySTi29/VXpvJNGiKh5ZJLup72eMdb3iSN/hH+KjxMJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034