UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PJNoQv2MmjTOGeZPdvBs+Cjg5dCnmKdPI/c3gLRaJlE=' 
WHERE 
  key_id = '98bc29fac9fe8decb8887718bb005e0b51b3ba4677cb76261c44c4237bec1737' 
  AND (
    token = 'PJNoQv2MmjTOGeZPdvBs+Cjg5dCnmKdPI/c3gLRaJlE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031