UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cIvKwVqlNicqYDQ6h0rZgr1W9hHjUqPqtYWSyMLaEYE=' 
WHERE 
  key_id = '482b8530d9da8f628e4e7e3c3f2539aced7505455f481e988102bcca1cdd4718' 
  AND (
    token = 'cIvKwVqlNicqYDQ6h0rZgr1W9hHjUqPqtYWSyMLaEYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028