UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kz+XUBff3cUiAuDMSauwFhK/39tzelhzQGdgLzeF7l8=' 
WHERE 
  key_id = '378ff6f624b552bb1012d21519bcbba8746ed5befcb4fe66133b77174791ff6a' 
  AND (
    token = 'kz+XUBff3cUiAuDMSauwFhK/39tzelhzQGdgLzeF7l8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033