UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mwbz9njz+DfcxZ1QnmVvS9rdb/FlQUAZZw+KZmvPBKs=' 
WHERE 
  key_id = '3a29941f8e6a632394a641701c48680d2d3d3f2bdb5d388a9ed7c3d89116bc4b' 
  AND (
    token = 'mwbz9njz+DfcxZ1QnmVvS9rdb/FlQUAZZw+KZmvPBKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043