UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UOuCGtDMwWAuR7NIN1ix5+fS7Gm5WyTMx+0/1ET647E=' 
WHERE 
  key_id = '9b07d707789d8d51c09df118b36f440e24b2cf46aca8bd9873b040215364051e' 
  AND (
    token = 'UOuCGtDMwWAuR7NIN1ix5+fS7Gm5WyTMx+0/1ET647E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040