UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TJ+GNrFt12b/fk8DvPxu/rS5dDQlJKqCgwLENpU5HkM=' 
WHERE 
  key_id = '802ab236751ed4c1906313673af37cf8c6d150da2abb689189108336d9abb3e1' 
  AND (
    token = 'TJ+GNrFt12b/fk8DvPxu/rS5dDQlJKqCgwLENpU5HkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036