UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vXuN/7x46MSs0V3eY8LvHfBX58IFWfhuJ7QklCS5puo=' 
WHERE 
  key_id = '8c5c643b9a44a82dabbde6107156eebef50e031d61339e2a2be2999c2cf5a926' 
  AND (
    token = 'vXuN/7x46MSs0V3eY8LvHfBX58IFWfhuJ7QklCS5puo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023