UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I0It+OjZW3pPKJB+4THAS6GwFsYgTNFdnakx+GxbO8Q=' 
WHERE 
  key_id = '90a5020ba6e6386548aec5e633ce7b8c2f8682e851aba38e68cd48f101bf5be0' 
  AND (
    token = 'I0It+OjZW3pPKJB+4THAS6GwFsYgTNFdnakx+GxbO8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045