UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MmG0IKGQGid0R6pLcv+VuAtrLjcOi2c9tyRgAX5QKRE=' 
WHERE 
  key_id = '9a9cd59c59a60033b152fbad9d65d34da6793b97cfae1ea22a357febc54190da' 
  AND (
    token = 'MmG0IKGQGid0R6pLcv+VuAtrLjcOi2c9tyRgAX5QKRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036